/*	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------*/
/*!	@file	<config.h>
	@path	~/src/config/
	@date	2007/06/14
	@desc	Build configuration.
*/

/* ANSI C compatible. */

#pragma once

/* Should we only support native code page? */
#pragma setlocale("english")

/* C4819 : 
	The file contains a character that cannot be represented in the current code page (number).
	Save the file in Unicode format to prevent data loss.
*/
#pragma warning(disable:4819)

/* Build configuration check. */

#if (defined _M_IX86)
#		define	XERES_PLATFORM		"x86"
#	elif (defined _M_X64)
#		define	XERES_PLATFORM		"x64"
#	else
#		error Unrecognized platform!
#endif

/* Build configurations. */

/*!
	\def	XERES_CONFIG_USE_MSPACE
	\brief	Set to active 'mspace' memory manager.
*/
#define XERES_CONFIG_USE_MSPACE						1

/*!
	\def	XERES_CONFIG_USE_CUSTOM_NEW
	\brief	Set to active customized global new operator.
*/
#define	XERES_CONFIG_USE_CUSTOM_NEW					1

/*!
	\def	XERES_CONFIG_EPSILON_NORMALIZE
	\brief	Set to active non-branch way of ignoring zero-length vector normalize.
*/
#define	XERES_CONFIG_EPSILON_NORMALIZE				0

/*!
	\def	XERES_CONFIG_NORMALIZE_EXCEPTION
	\brief	Active normalize zero vector exception.
*/
#define	XERES_CONFIG_NORMALIZE_EXCEPTION			1

/*!	
	\def	XERES_CONFIG_ENABLE_COUNTER_STAT
	\brief	Enables or disables counter statistics.
*/
#ifndef _FINAL
#define	XERES_CONFIG_ENABLE_COUNTER_STAT			1
#else
#define	XERES_CONFIG_ENABLE_COUNTER_STAT			0
#endif

/*!	
	\def	XERES_CONFIG_ENABLE_OBSERVER
	\brief	Enables or disables observer.
*/
#ifndef _FINAL
#define	XERES_CONFIG_ENABLE_OBSERVER				1
#else
#define	XERES_CONFIG_ENABLE_OBSERVER				0
#endif

/*!	
	\def	XERES_CONFIG_SUPPORT_GDIPLUS
	\brief	Enables support of GDI+.
*/
#define	XERES_CONFIG_SUPPORT_GDIPLUS				1

/*!
	\def	PURIFY_BUILD
	\brief	Tag to indicate build for purify run ready.
*/
#define	PURIFY_BUILD								0

/* Debug configurations. */

/*!
	\def	XERES_DEBUG_ENABLE_TRACKING
	\brief	Active function scope tracking,
			every specified scope will be note in a stack.
*/
#if (defined _DEBUG)
#define	XERES_DEBUG_ENABLE_TRACKING					0
#elif (defined _TEST)
#define	XERES_DEBUG_ENABLE_TRACKING					0
#else
#define	XERES_DEBUG_ENABLE_TRAKCING					0
#endif

/*!
	\def	XERES_DEBUG_ENABLE_THREAD_SAFE_CHECK
	\brief	Active thread safe checking,
			which checks if function is running on specific threads.
*/
#if (defined NDEBUG)
#define	XERES_DEBUG_ENABLE_THREAD_SAFE_CHECK		0
#else
#define	XERES_DEBUG_ENABLE_THREAD_SAFE_CHECK		1
#endif


/* Exception handling. */

/*!
	\def	XERES_ENABLE_SE_TO_CE_MAPPING
	\brief	Active mapping SE to CE feature.
*/
#define	XERES_ENABLE_SE_TO_CE_MAPPING				0


/* Mathematics configurations. */

/*!
	\def	XERES_MATH_GENERATE_HALF_TABLE
	\brief	Enable generation of acceleration table of 'half'.
*/
#define	XERES_MATH_GENERATE_HALF_TABLE				1

/*!
	\def	XERES_MATH_USING_HALF_AS_GLOBAL
	\brief	Introduce 'half' type to global namespace.
*/
#define	XERES_MATH_USING_HALF_AS_GLOBAL				1

/*!
	\def	XERES_MATH_USING_DX3DMATH
	\brief	User DX3D's math function instead of xeres's.
*/
#define	XERES_MATH_USING_DX3DMATH					0


/* IObject system debug. */

/*!
	\def	XERES_IOBJECT_REFERENCE_DEBUG
	\brief	Active IObject's reference debug, to track abnormal reference count.
*/
#if (defined NDEBUG)
#define	XERES_IOBJECT_REFERENCE_DEBUG				0
#else
#define	XERES_IOBJECT_REFERENCE_DEBUG				0
#endif

/*!
	\def	XERES_IOBJECT_INSTANCE_TRACE
	\brief	Trace all IObject instance, stores a local copy.
*/
#if (defined NDEBUG)
#define	XERES_IOBJECT_INSTANCE_TRACE				0
#else
#define	XERES_IOBJECT_INSTANCE_TRACE				0
#endif

/* Resource & database debug. */
#if (defined NDEBUG)
#define	XERES_CHECK_REDUNDANT_RESOURCE				0
#else
#define	XERES_CHECK_REDUNDANT_RESOURCE				1
#endif

/* Compiler configurations */

#ifdef _MSC_VER

/* C4512:
	The compiler cannot generate an assignment operator for the given class.
	No assignment operator was created.
*/
#	pragma warning(disable:4512)

/* C4201:
	nonstandard extension used : nameless struct/union
*/
#	pragma warning(disable:4201)

/* C4714:
	function 'function' marked as __forceinline not inlined
*/
/*#	pragma warning(disable:4714)*/

#	define  _CRT_SECURE_NO_DEPRECATE					1
#	define	_CRT_NON_CONFORMING_SWPRINTFS				1

#	define	_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 	1
#	define	_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES		1

#	define _SCL_SECURE_NO_WARNINGS						1

#endif /* _MSC_VER */

#ifdef __ICL

/* meaning less semi-COLON */
#	pragma warning(disable:424)

/* extra comma*/
#	pragma warning(disable:271)

#endif /* __ICL */

/* Extend inline functions while using ICL & MSVC. */
#if (defined _FINAL)
#	if ( ( (defined __ICL) || (defined _MSC_VER) ) && defined _RELEASE )

		/* Make sure inline is strongly demanded. */

#		define inline	__forceinline

		/* Should be a bad choice for smaller code? */
#		pragma inline_recursion(on)

		/* 5 is reasonable. */
#		pragma inline_depth(5)
#	endif
#endif /* _FINAL */

/* Include base after configuration. */
#include "xeres.h"

/* Include OS configurations. */
#ifndef XERES_CONFIG_NO_OS_H
#include "config/os.h"
#endif
